package com.lemo.m2;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter(filterName = "MyFilter",urlPatterns = "/*")
public class MyFilter implements Filter {

    private static final Logger logger = LoggerFactory.getLogger("MyFilter");

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {
        logger.info("-------------------------->init");
    }

    @Override
    public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
        logger.info("-------------------------->doFilter");
        chain.doFilter(request, response);
    }

    @Override
    public void destroy() {
        logger.info("-------------------------->destroy");
    }
}
